<!DOCTYPE html>
<html>
<head>
    <link rel="import" href="../_include/_jx.html?__inline">
</head>
<body>
<link rel="import" href="../_include/_loading.html?__inline">
<div class="jxpanel" title="创建文章">
    <form class='jxform' method="post">
        <table class='table jxtable-form' style="width: 50%">
            <tr>
                <th class='w-110px'>发布名称</th>
                <td>
                    <input name='name' class='form-control'
                           maxlength="5"
                           data-validate="{required: [true,'请输入发布名称'],maxlength: [5,'发布名称长度不能超过{0}个字符']}"
                           autofocus autocomplete='off'/>
                </td>
            </tr>
            <tr>
                <th>身份证</th>
                <td>
                    <input name='idnum' class='form-control'
                           maxlength="18"
                           data-validate="{required: true,idNumber:true}"
                           autofocus autocomplete='off'/>
                </td>
            </tr>

            <tr>
                <th>版本</th>
                <td>
                    <select name='build' id='build' data-placeholder="请选择版本"
                            class='form-control jxselect'>
                        <option value='' selected='selected' data-keys=' '>请选择</option>
                        <option>张三</option>
                        <option>李四</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th>发布日期</th>
                <td><input type='text' name='date' class='form-control jxdate'/>
                </td>
            </tr>
            <tr>
                <th>描述</th>
                <td>
                            <textarea name='desc' id='desc' rows='10' style="resize: none"
                                      class='form-control'></textarea>
                </td>
            </tr>
            <tr>
                <th>附件</th>
                <td><span class="color-red">因为安全原因，Demo暂时不支持上传附件功能！</span></td>
            </tr>
        </table>
        <div class="jxpanel-footer pl-110">
            <button class="btn btn-primary" type="submit">
                <i class="fa fa-save"></i> 保存
            </button>
            <a class="btn btn-default ml-5" href="../data/grid.html">
                <i class="fa fa-sign-in"></i> 返回
            </a>
        </div>
    </form>
</div>
<script>
    $('form').on('beforesubmit', function () {
        var d = jx.serialize($(this));
        if (d.name == '22') {
            jx.alert('请输入');
            return false;
        }
    }).on('aftersubmit', function (e, result) {
        if (result.success) {
            window.location.href = 'grid.html';
        }
        else {
            jx.alert(result.message);
        }
    });

</script>
</body>
</html>
